import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from 'path'
import {viteExternalsPlugin} from "vite-plugin-externals";
import cssInjectedByJsPlugin from 'vite-plugin-css-injected-by-js';
import removeConsole from 'vite-plugin-remove-console';

export default defineConfig(({mode})=>{
  let usePlugins = [
    vue(),
    viteExternalsPlugin({
      vue: 'Vue',
    }),
    cssInjectedByJsPlugin(),
  ]
  if(!mode.includes('test')){
    usePlugins.push(removeConsole())
  }
  return {
    plugins: usePlugins,
    build: {
      outDir: "./dist",
      lib: {
        entry: "./index.js",
        name: "LfText",
        fileName: "lf-text",
      },
      /*rollupOptions: {
        external: ['element-plus']
      }*/
    },
    define: { 'process.env': {} }
  }
})